﻿//创建时间: 2010-10-29
//创建作者: 李晓忠
//功能说明: CMS系统 添加内容
//修改: 2010-10-29 
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using TRPOP.Common;
using TRPOP.CMS.Web.UI;


using TRPOP.CMS.Business;
using TRPOP.CMS.Model;
using Newtonsoft.Json;
namespace TRPOP.CMS.Web.Admin
{
    public partial class admin_publish_eidt : BaseAdmin
    {
        #region 当前页面权限验证
        protected override void SubPageInit()
        {
            base.m_SubPagePermission = Plugin.PermissionKeys.PermissionEnum.Content_AllControl;
        }
        #endregion

        #region 页面变量
        protected bool m_IsAdd = true;
        protected int m_intNId = 0;
        protected int m_intId = 0;
        protected string m_strParentName = "";
        protected string m_strNodeName = "";
        protected NodeInfo m_NodeInfo = new NodeInfo();
        protected NodeManage m_NodeManage = new NodeManage();
        protected string m_strAction = "";
        protected int m_intRecordCount = 0;
        protected string strOptions = "";
        #endregion

        #region 页面事件
        protected void Page_Load(object sender, EventArgs e)
        {
            m_intNId = RequestHelper.RequestInt("nodeid");
            m_strAction = RequestHelper.RequestString("ac");
            if (!IsPostBack)
            {
                LoadBase();
            }
        }

        #endregion

        #region 页面方法

        public void LoadBase()
        {

            if (m_strAction == "add" || m_strAction == "edit")
            {
                #region
                List<NodeInfoWithLevel> m_NodeListTree = (new NodeManage()).GetNodeListTree(0, 0, "");
                //2011.07.05 lcheg begin 增加此判断，为了防止system.nullreferenceexception 的异常
                if (m_NodeListTree == null)
                    m_NodeListTree = new List<NodeInfoWithLevel>();
                //2011.07.05 lcheg end
                foreach (NodeInfoWithLevel info in m_NodeListTree)
                {
                    if (info.NodeId == m_intNId)
                    {
                        strOptions += "<option value=\"" + info.NodeId + "\" selected=\"selected\">" + PageAssist.AppendStr(info.Level, ("&nbsp;&nbsp;&nbsp;&nbsp;")) + " -" + info.Name + "</option>";
                    }
                    else
                    {
                        strOptions += "<option value=\"" + info.NodeId + "\">" + PageAssist.AppendStr(info.Level, ("&nbsp;&nbsp;&nbsp;&nbsp;")) + " -" + info.Name + "</option>";
                    }
                }
                #endregion
            }
            else if (m_strAction == "resetnode")
            {

            }
        }
        #endregion
    }
}
